//
//  LJLTopRadioTVC.m
//  聆听FM
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 Dark. All rights reserved.
//

#import "LJLTopRadioTVC.h"

@implementation LJLTopRadioTVC

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftIV = [[UIImageView alloc] init];
        [self.contentView addSubview:self.leftIV];
        self.rnameL = [[UILabel alloc] init];
        self.rnameL.textColor = [UIColor whiteColor];
        self.rnameL.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.rnameL];
        self.programL = [[UILabel alloc] init];
        self.programL.textColor = [UIColor colorWithWhite:1 alpha:0.5];
        self.programL.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.programL];
        self.personL = [[UILabel alloc] init];
        self.personL.textColor = [UIColor colorWithWhite:1 alpha:0.5];
        self.personL.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.personL];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.leftIV.frame = CGRectMake(5, 5, 90, 90);
    self.rnameL.frame = CGRectMake(100, 5, 175 * FITWIDTH, 30);
    self.programL.frame = CGRectMake(100, 35, 175 * FITWIDTH, 30);
    self.personL.frame = CGRectMake(100, 65, 175 * FITWIDTH, 30);
}
- (void)setModel:(LJLRadioPageModel *)model
{
    if (_model != model) {
        _model = model;
        
        [self.leftIV sd_setImageWithURL:[NSURL URLWithString:model.radioCoverLarge] placeholderImage:[UIImage sd_animatedGIFNamed:@"占位图"]];
        self.rnameL.text = model.rname;
        if (model.programName == nil) {
            self.programL.text = [NSString stringWithFormat:@"当前没有节目"];
        }
        else
        {
        self.programL.text = [NSString stringWithFormat:@"正在直播 : %@",model.programName];
        }
        if (model.radioPlayCount > 10000) {
            self.personL.text = [NSString stringWithFormat:@"%.1f万人",model.radioPlayCount / 10000.0];
        }
        else
        {
            self.personL.text = [NSString stringWithFormat:@"%ld人", model.radioPlayCount ];
        }
        
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
